#ifndef __MAINWND__
#define __MAINWND__

#include "frameui/framewnd.h"
#include "frameui/controlframes.h"
#include "inject.h"

class RectWindow;
class OverlayPainter;
class TwitchClient;
class OverlayWindow;
class MainWnd : public RootWindow
{
  OverlayPainter* painter;
  TwitchClient* client;
  OverlayWindow* overlay;
  EditFrame* iName;
  EditFrame* iPass;
  EditFrame* iChan;
  EditFrame* iPort;
  ButtonFrame* iConnect;
  RectWindow* iRect;
  ColorFrame* iBackColor;
  SliderFrame* iBackAlpha;
  ColorFrame* iTextColor;
  ButtonFrame* iTextFont;
  ComboFrameEx* iProcList;
  ButtonFrame* iAttach;
  ButtonFrame* iPosLocked;
  ButtonFrame* iPosReset;
  HotkeyFrame* iToggleKey;
  HotkeyFrame* iReplyKey;
  ButtonFrame* iHidden;
  int padding;
  bool connected;
  int getHeight(int width);
  uint32 onMessage(uint32 message, uint32 wParam, uint32 lParam);
  StaticFrame* addTip(Frame* frame, wchar_t const* text);
  void setConnected(bool connected);
  Array<ProcessEntry> proclist;
  void attach(int i);

  DWORD oldPID;
  DWORD idInterface;
  HICON hIcon;

  BOOL attached64;
  DWORD mouseThread;
  HANDLE hTargetProcess;
  HHOOK hHook;
  HHOOK hMouseHook;
  HHOOK hKeyboardHook;
public:
  MainWnd(OverlayPainter* painter, TwitchClient* client);
  ~MainWnd();

  void updateImage();
  SIZE previewSize();

  void setTargetThread(DWORD id);

  void addMessage(int type, char const* name, char const* text);
  void updateOverlay();
};


#endif // __MAINWND__
